package com.itheima.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

//@Aspect
@Component
public class MyAspect2 {

    @Pointcut("execution(* com.itheima.service.impl.*.*(..))")
    private void pt(){}
    @Before("pt()")
    public void before(){
        System.out.println("前置通知2");
    }
    @Around("pt()")
    public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
        System.out.println("环绕前通知2");
        Object result = joinPoint.proceed();
        System.out.println("环绕后通知2");

        return result;
    }
    @AfterReturning("pt()")
    public void afterReturning(){
        System.out.println("后置通知2");
    }
    @AfterThrowing("pt()")
    public void afterThrowing(){
        System.out.println("异常通知2");
    }
    @After("pt()")
    public void after(){
        System.out.println("最终通知2");
    }
}
